package ynu.edu.order.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import ynu.edu.order.entity.OrderItem;

import java.util.List;

/**
 * 订单项数据访问层
 */
@Repository
public interface OrderItemRepository extends JpaRepository<OrderItem, Long> {

    /**
     * 根据订单ID查询订单项列表
     * @param orderId 订单ID
     * @param isDeleted 是否删除
     * @return 订单项列表
     */
    List<OrderItem> findByOrderIdAndIsDeleted(Long orderId, Integer isDeleted);

    /**
     * 根据菜品ID查询订单项列表
     * @param dishId 菜品ID
     * @param isDeleted 是否删除
     * @return 订单项列表
     */
    List<OrderItem> findByDishIdAndIsDeleted(Long dishId, Integer isDeleted);
} 